<template>
  <div class="tixian_box">
    <ul class="tixian_ul">
       <li class="tixian_li">
        <span>持卡人</span>
        <input type="text" v-model="card" placeholder="请填写持卡人" />
      </li>
      <li class="tixian_li">
        <span>银行卡号</span>
        <input type="number" v-model="yinhangka" placeholder="请填写银行卡号" />
      </li>
      <li class="tixian_li">
        <span>金额</span>
        <input type="number" v-model="jine" placeholder="请填写提现金额" />
      </li>
      <li class="tixian_li">
        <span>密码</span>
        <input type="password" v-model="mima" placeholder="请填写登录密码" />
      </li>
    </ul>
    <p class="yinhangka_p2">温馨提示：请准确填写基本信息，避免充值信息核对错误！</p>
    <button class="red_btn" @click="tijiao_btn">确认提交</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      card:"",//请填写持卡人
      yinhangka: "", //请填写银行卡号
      jine: "", //请填写充值金额
      mima: "" //请填写登录密码
    };
  },
 //   渲染之前
  created() {
    //   get提交
    this.http.get("/api/member/info").then(res => {
      console.log(res)
      if (res.status_code == 200) {
        this.yinhangka = res.data.card_num, //银行卡号
        this.card = res.data.open_bank_name //持卡人
      } else {
        this.$toast(res.message);
      }
    });
  },
  methods: {
	//   提交
    async tijiao_btn() {
		// 判断为空
		if (!this.card||!this.yinhangka||!this.jine||!this.mima) {
			// 提示
      this.$toast("请输入完善信息");			
		}
		// 对接口
		try {
			let res=await this.http.post("/api/member/withdrawal",{
				// 对参数
				bank_card:this.yinhangka,
				amount:this.jine,
        login_pwd:this.mima,
        bankcard_name:this.card  //提交添加持卡人
			});
			// 判断正确与失败
			if (res.status_code==200) {
         this.$toast("提交成功");
          this.$router.back();
			} else {
          this.$toast(res.message);
			}
		} catch (error) {
//			this.$toasted.error(error.message,{icon:"error"}).goAway(2000);
		}
	}
  }
};
</script>

<style>
@import url("../../assets/css/ttcp/chongzhi.css");
.tixian_box {
  background-color: #f2f2f2;
  height: 100vh;
}
.tixian_ul .tixian_li span{font-size: 0.3rem;height: 0.91rem;line-height: 0.91rem;}
.tixian_ul .tixian_li input{font-size: 0.3rem;height: 0.91rem;line-height: 0.91rem;}
.tixian_box .tixian_ul .tixian_li{padding: 0 0.3rem;}
</style>